# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=squark
pkgver=0.6.1
pkgrel=2
pkgdesc="Squark - Squid User Authentication and Rating Kit"
subpackages="$pkgname-dbg $pkgname-doc"
depends="haserl"
makedepends="net-snmp-dev cmph-dev lua-dev"
source="https://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
	"
url="https://git.alpinelinux.org/cgit/squark/"
arch="all"
license=GPL2
install="$pkgname.post-install"

prepare() {
	cd "$srcdir"
	ln -s squark-master $pkgname-$pkgver
	cd "$srcdir/$pkgname-$pkgver"
	sed -i -e 's:-Werror::' Make.rules
	for i in $source; do
		case $i in
		*.patch) patch -p1 -i "$srcdir"/$i || return 1
		esac
	done
	sed -i -e 's:lua5.1:lua:g' "$srcdir"/"$pkgname-$pkgver"/src/Makefile
}

build() {
	cd "$srcdir/$pkgname-$pkgver"
	make FULL_VERSION="$pkgver-r$pkgrel" || return 1
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	make FULL_VERSION="$pkgver-r$pkgrel" DESTDIR="$pkgdir" install
}

sha512sums="f04b0cf5e300bab43bbc768a30cb8339e8a026d6fc090ccf3c98c0fa932a4cf3ef2ed11e5b5b94a68e1f7577fa3875cd537c6ed535e2af012b6d464b20123f3e  squark-0.6.1.tar.xz"
